/*
 * badge4.c: Badge 4 specific stuff
 *
 * Copyright (C) 2001  Hewlett-Packard Company
 * Written by Christopher Hoover <ch@hpl.hp.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ident "$Id: badge4.c,v 1.3 2002/01/03 16:07:17 erikm Exp $"

#ifdef HAVE_CONFIG_H
# include <blob/config.h>
#endif

#include <blob/flash.h>
#include <blob/init.h>
#include <blob/sa1100.h>
#include <blob/serial.h>

/* flash descriptor for Badge4 flash */
/* 1 x Intel 28F320C3BA100 Advanced+ Boot Block Flash (32 Mbit) */
/* http://developer.intel.com/design/flcomp/datashts/29064512.pdf */
static flash_descriptor_t badge4_flash_descriptors[] =
{
	{
		/* Eight 4 KW Parameter Bottom Blocks (64K bytes) */
		size: 2 * 4 * 1024,
		num: 8,
		lockable: 1
	},
	{
		/* Sixty three 32 KW Main Blocks (4032K bytes) */
		size: 2 * 32 * 1024,
		num: 63,
		lockable: 1
	},
	{
		/* NULL block */
	},
};




static void init_flash_driver(void)
{
	flash_descriptors = badge4_flash_descriptors;
	flash_driver = &intel16_flash_driver;
}

__initlist(init_flash_driver, INIT_LEVEL_DRIVER_SELECTION);


static void init_hardware(void)
{
	// GPIO 19 and 20 specify SDRAM "type".
	// These settings are for 12 row bits, 9 col bits.
	// ### Incorporate SPD code here.
	GPDR |= (GPIO_GPIO19 | GPIO_GPIO20);
	GPSR = GPIO_GPIO19;
	GPCR = GPIO_GPIO20;

	/* select serial driver */
	serial_driver = &sa11x0_serial_driver;
}


__initlist(init_hardware, INIT_LEVEL_DRIVER_SELECTION);
